﻿using System;

class AllTheVariation
{
    static int n = int.Parse(Console.ReadLine());
    static int k = int.Parse(Console.ReadLine());

    static void Variation(int[] arr, int index)
    {
        if (index == arr.Length)
        {
            Print(arr);
        }
        else
        {
            for (int i = 1; i <= n; i++)
            {
                arr[index] = i;
                Variation(arr, index + 1);
            }
        }
    }
    static void Print(int[] arr)
    {
        for (int i = 0; i < arr.Length; i++)
        {
            Console.Write(arr[i] + " ");
        }
        Console.WriteLine();
    }
    static void Main(string[] args)
    {
        int[] arrVariations = new int[k];
        Variation(arrVariations, 0);
    }
}

